  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>查看订单</title>
<#include "/jspgou_sys/head.html"/>
<script src="${base}/res/common/js/pony.tree.js" type="text/javascript"></script>
<link href="${base}/res/jspgou/css/product.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});

function changeCount(){
	var totalWeight=0.0;
	$("#[id^='itemCount_']").each(function(){
		var ss=parseFloat(jQuery(this).val());
		var h=jQuery(this).attr("id");
		var index=h.split("_")[1];
		var weight=$("#itemWeight_"+index).html();
		totalWeight+=ss*weight;
	});
	ajaxtotalDeliveryFee($("#shippingId").val(),totalWeight);
	setTimeout(function(){changePrice()},1000);
}

function changePrice(){
	var totalPrice=0.0;
	$("#[id^='itemPrice_']").each(function(){
		var ss=parseFloat(jQuery(this).val());
		var h=jQuery(this).attr("id");
		var index=h.split("_")[1];
		var count=$("#itemCount_"+index).val();
		$("#subtotal_"+index).html("");
		$("#subtotal_"+index).html(count*ss);
		totalPrice+=count*ss;
	});
	$("#productPrice").html("");
	$("#productPrice").html(totalPrice);
	$("#total").html("");
	$("#total").html(parseFloat($("#freight").val())+totalPrice);
	$("#totalPice").val(parseFloat($("#freight").val())+totalPrice);
}

function changeFreight(){
	var ss=parseFloat($("#productPrice").html());
	$("#total").html("");
	ss+=parseFloat($("#freight").val());
	$("#total").html(ss);
}

function ajaxtotalDeliveryFee(d,w){
	$.post("../order/ajaxtotalDeliveryFee.do", {
		'deliveryMethod':d,
		'weight':w
	}, function(data) {
		if(data.status==1){
			$("#freight").val(data.freight);
			return data.freight;
		}
	},'json');
}

function statusChange(status){
	if(status==19){
      $("#jvForm").attr("action","o_returnMoney.do");
	}
	$("#status").val(status);
}
</script>
<style type="text/css">
.addr{padding:2px 0;}
.title{font-size:14px;}
</style>
</head>
<body>
<div class="body-box">
<div class="rhead">
	<div class="rpos">单签位置:  订单管理 - 查看</div>
	<form class="ropt">
		<input type="button" value="返回列表" onclick="history.back();"/>
	</form>
	<div class="clear"></div>
</div>
<#if order.returnOrder??>
	<#if order.paymentStatus==2>
		<#if order.shippingStatus==1>	
			<@s.m "order.PromptShippingStatusNo"/>
		</#if>
		<#if order.shippingStatus==2>
			<@s.m "order.PromptShippingStatusYes"/>
		</#if>
	</#if>
<#else>
<form id="jvForm" method="post" style="padding-top:5px">
	<input type="hidden" name="id" value="${order.id}"/>
	<input type="submit" value="确认" onclick="this.form.action='o_affirm.do'" 
	<#if order.paymentStatus!=2>
		disabled
	<#elseif order.status!=1>
		disabled
	</#if>/>
	<input type="button" value="<@s.m 'order.paymentStatus.${order.paymentStatus}'/>"/>
	<input type="submit" value="发货" onclick="this.form.action='v_sendGoods.do'" 
	<#if order.shippingStatus!=1>
		disabled
	<#elseif order.status!=2>
		disabled
	<#elseif order.paymentStatus!=2>
		disabled
	</#if>/>
	<input type="submit" value="完成" onclick="this.form.action='o_accomplish.do'" 
	<#if order.shippingStatus!=2>
		disabled
	<#elseif order.paymentStatus!=2>
		disabled
	<#elseif order.status!=2>
		disabled
	</#if>/>
	<input type="submit" value="取消"  onclick="this.form.action='o_abolish.do'" 
	<#if order.status==3>
		disabled
	<#elseif order.shippingStatus==2>
		disabled
	<#elseif order.paymentStatus==2>
		disabled
	<#elseif order.status==4>
		disabled
	</#if>/>
</form>
</#if>
<@p.form id="jvForm" action="o_update.do" labelWidth="12">
<@p.td colspan="2"><strong class="title">商品信息</strong></@p.td><@p.tr/>
<@p.td colspan="2">
<@p.table value=order.items;item,i,has_next><#rt/>
	<@p.column code="商品编号" style="width:100px">
		<#if item.product.productExt.code??>${item.product.productExt.code}</#if>
	</@p.column><#t/>
	<@p.column code="商品名称" align="left">
		<img src="${base!}${item.product.productExt.coverImg!}" width="50" height="50"/>
		${item.product.name!}&nbsp;
		<#if item.productFash??>${item.productFash.nature!}</#if>
	</@p.column><#t/>
	<@p.column code="成交价" style="width:110px">
	 	${item.salePrice!}
	</@p.column><#t/>
	<@p.column code="单重" style="width:60px">
		<span id="itemWeight_${item.id}">${item.product.weight}</span>
	</@p.column><#t/>
	<@p.column code="购买数量" style="width:60px">
		${item.count}
	</@p.column><#t/>
	<@p.column code="小计" style="width:100px">
		<span >
				${item.salePrice*item.count!0}
	 	</span>
	</@p.column><#t/>
</@p.table>
</@p.td><@p.tr/>

<@p.td colspan="2"><strong class="title">订单信息</strong></@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="订单编号">${order.code}</@p.td>
<@p.td colspan="1" width="50" label="下单日期">${order.createTime}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="状态">
	<@s.m "order.status.${order.status}"/>
</@p.td>
<@p.td colspan="1" width="50" label="支付状态">
	<@s.m "order.paymentStatus.${order.paymentStatus}"/>
</@p.td>
<@p.tr/>
<@p.td colspan="1" width="50" label="配送状态">
	<@s.m "order.shippingStatus.${order.shippingStatus}"/>
</@p.td>
<@p.td colspan="1" width="50" label="下单配送物流">${order.shipping.name}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="商品总金额"><span id="productPrice">${order.productPrice}</span></@p.td>
<@p.td colspan="1" width="50" label="运费" required="true">${order.freight!}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="订单总额">
	<span id="total">${order.total!0}</span>
	<input type="hidden" id="totalPrice" name="totalPrice" value="${order.total!0}"/>
</@p.td>
<@p.td colspan="1" width="50" label="支付方式">
	<#if order.payment??>
		${order.payment.name}
	</#if>
</@p.td><@p.tr/>

<@p.td colspan="2"><strong class="title">收货人信息</strong></@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="收货人姓名">${order.receiveName!}</@p.td>
<@p.td colspan="1" width="50" label="收货人移动电话">${order.receiveMobile!}</@p.td><@p.tr/>
<@p.td colspan="1" width="50" label="收货人固定电话">${order.receivePhone!}</@p.td>
<@p.td colspan="1" width="50" label="收货人邮编">${order.receiveZip!}</@p.td><@p.tr/>
<@p.td colspan="2" label="收货人地址">${order.receiveAddress!}</@p.td><@p.tr/>
<@p.td colspan="2" label="order.comments">${order.comments!}</@p.td><@p.tr/>
</@p.form>
</div>
</body>
</html>